package trb.complexshield.benchmarking;

import javax.vecmath.Point3i;
import no.hrp.hvrc.property.DefaultPropertyOwner;
import no.hrp.hvrc.property.Property;
import no.hrp.hvrc.property.PropertyOwnerFactory;

public class BenchmarkOutput extends DefaultPropertyOwner {

    public final Property<String> shapeName = addObjectProperty("ShapeName", "");
    public final Property<String> name = addObjectProperty("Name", "");
    public final Property<Long> timeNano = addObjectProperty("TimeNano", 0l);
    public final Property<Float> totalDistanceInsideShield = addObjectProperty("TotalDistanceInsideShield", 0f);
    public final Property<Float> totalDifferance = addObjectProperty("TotalDiffereance", 0f);
    public final Property<Float> testTotal = addObjectProperty("TestTotal", 0f);
    public final Property<Float> correctSum = addObjectProperty("CorrectSum", 0f);
    public final Property<Long> memoryUsedBeforeCreation = addObjectProperty("MemoryUsedBeforeCreation", 0l);
    public final Property<Long> memoryUsedAfterCreation = addObjectProperty("MemoryUsedAfterCreation", 0l);
    public final Property<Long> memoryUsedAfterPerformance = addObjectProperty("MemoryUsedAfterPerformance", 0l);
    public final Property<Long> creationTimeNano = addObjectProperty("CreationTimeNano", 0l);
    public final Property<Integer> voxelDim =  addObjectProperty("VoxelDim", 0);
    public final Property<Point3i> voxelDims =  addObjectProperty("VoxelDims", new Point3i());
    public final Property<Integer> triangleCount =  addObjectProperty("TriangleCount", 0);

    public static BenchmarkOutput create(String shapeName, String name) {
        BenchmarkOutput output = PropertyOwnerFactory.create(BenchmarkOutput.class);
        output.shapeName.set(shapeName);
        output.name.set(name);
        return output;
    }

    public float getErrorPerc() {
        return totalDifferance.get() * 100f / correctSum.get();
    }

    public String toString() {
        return "bbb";
    }
}
